package love.baby;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.concurrent.TimeoutException;

/**
 * @create: 2022-03-01 10:04
 * @description:
 **/

public class MqProducer {


    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = MqBase.initChannel();
        System.out.println("输入需要发送的消息：");
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String msg = scanner.nextLine();
            channel.basicPublish("",MqBase.QUEUE_NAME,null,msg.getBytes());
        }
        System.out.println("发送完毕!");
    }
}
